{% set clazz = "order" %}
{% set title = "订单详情" %}
{% extends './modules/common/templates/main.html' %}
{% block style %}
  <link rel="stylesheet" type="text/css" href="{{ '/static/css/store.css'|version }}" />
{% endblock %}
{% block content %}
  {% if !nested %}
    <header class="bar bar-header">
      {{ macro.back() }}
      <h1 class="title">{{ title }}</h1>
    </header>
  {% endif %}
  <section>
    <div class="solid-bg">
      <div class="hspace vspace">
        <p>订单状态：{{orderBase.orderStatus|orderStatusFilter}}</p>
        <p>订单编号：{{orderBase.orderCode}}</p>
        <p>下单时间：{{orderBase.createTime|date('Y-m-d H:i:s')}}</p>
      </div>
    </div>
    <div class="list">
      <a class="item" href="javascript:;">
        <span class="text">状态追踪</span>
        <span class="extra">即将开通</span>
      </a>
    </div>
    <div class="list">
      <div class="item-divider">送货上门</div>
      <div class="item">
        <span class="text">
          <span class="pull-right">{{orderDelivery.receiveUserPhone}}</span>
          收货人：{{orderDelivery.receiveUserName}}
          <div class="brief">{{orderDelivery.deliveryAddress}}</div>
        </span>
      </div>
    </div>
    <div class="list">
      <div class="item-divider">商品信息</div>
      {% for goods in orderGoods %}
        <div class="item">
          <div class="avatar">
            <img src="{{goods.skuImgUrl}}" ui-mode="80px">
          </div>
          <span class="text">
            {{goods.goodsName}}
            <div class="brief">价格：{{goods.price|currency}} <span class="hspace">数量：{{goods.buyNum}}</span></div>
          </span>
        </div>
      {% endfor %}
    </div>
    <div class="list">
      <div class="item">
        <span class="text text-sm">
          <span class="pull-left">订单总额</span>
          <span class="pull-right">{{orderBase.totalPrice|currency}}</span>
        </span>
      </div>
      {% for item in goodsPromotiones %}
        <div class="item">
          <span class="text text-sm">
            <span class="pull-left text-sm">{{item.promotionName}}</span>
            <span class="pull-right">-{{item.discount|currency}}</span>
          </span>
        </div>
      {% endfor %}
      {% for item in orderPromotiones %}
        <div class="item">
          <span class="text text-sm">
            <span class="pull-left text-sm">{{item.promotionName}}</span>
            <span class="pull-right">-{{item.discount|currency}}</span>
          </span>
        </div>
      {% endfor %}
      {% if couponCodePromotion %}
        <div class="item">
          <span class="text text-sm">
            <span class="pull-left text-sm">{{couponCodePromotion.promotionName}}</span>
            <span class="pull-right">-{{couponCodePromotion.discount|currency}}</span>
          </span>
        </div>
      {% endif %}
      <div class="item">
        <span class="text text-sm">
          <span class="pull-left">应付金额</span>
          <span class="pull-right">{{orderBase.shouldPay|currency}}</span>
        </span>
      </div>
    </div>
    {% if orderInvoice && orderInvoice.invoiceTitle %}
      <div class="list">
        <div class="item">
          <span class="text pull-left">发票信息</span>
          <span class="text text-sm pull-right">{{orderInvoice.invoiceTitle}}</span>
        </div>
      </div>
    {% endif %}
    <div class="list">
      <div class="item">
        {% if orderBase.orderStatus == 1 || orderBase.orderStatus == 4 %}
          <span class="text">总额：{{orderBase.shouldPay|currency}}</span>
        {% else %}
          <span class="text">总额：{{orderBase.totalRealPay|currency}}</span>
        {% endif %}
        <span class="extra">
          {% if orderBase.orderStatus == 1 %}
            <a href="/store/cashier/paytype/{{orderBase.orderCode}}" class="button inline primary light tiny">代收款</a>
          {% elseif orderBase.orderStatus == 2 && orderBase.providerId == vendorId %}
            <a href="/store/delivery/{{orderBase.orderCode}}?providerId={{orderBase.providerId}}" class="button inline primary light tiny">确认发货</a>
          {% endif %}
        </span>
      </div>
    </div>
  </section>
{% endblock %}
{% block script %}
  {% parent %}
  <script src="{{ '/static/js/store.js'|version }}"></script>
{% endblock %}